package base;

/**
 * @author He Changjie on 2021/8/14
 */
public class Base19 {
    /**
     * 走阶梯，有n级阶梯，一次可以走一级、两级或者三级，请编写一个函数计算走完该阶梯一共有多少种种方法
     * @param args
     */
    public static void main(String[] args) {
        System.out.println(numWays(4));
    }

    public static int numWays(int n){
        int a = 1, b = 1, c = 2, sum;
        for(int i = 0; i < n; i ++){
            sum  = a + b + c;
            a = b;
            b = c;
            c = sum;
        }
        return a;
    }
}
